Machine vision systems may be used to inspect objects based on their color(s). In industrial applications, such vision systems may inspect the colors of, for example, work pieces, produce, and color-coded pills. Color may be an important indicator of whether a colored component is properly placed in a work piece, whether produce is ripe or overripe, or whether a particular color-coded pill is in the proper location in its container. Such vision systems may also be used in medical applications to determine the composition of cells, in which different cell components are dyed different colors.
Pixels in digital images may have one of thousands, even millions, of possible color values (e.g., 16 bit and 24 bit color). Machine vision systems may be interested in ranges of related color values which fall between upper and lower thresholds. These ranges of color values may be referred to as keyed colors. Transforming a raw pixel color value to a keyed color may simplify downstream processing in the vision system.
In imaging analysis, the observed color of an object may be affected by the background on which it is observed. In such situations, the observed color tends to smear toward the background color. For example, a thin cell component dyed blue and observed on an illuminated slide may appear light blue to an imaging system. For thicker objects, shading or highlights on the object may be affected by the background color. Such background effects may adversely affect the transformation of an observed pixel color value to an appropriate keyed color.
A keyed color generator according to an embodiment may include several color channels, each corresponding to a color component value, e.g., red, green, and blue components (RGB). The color component values for a scanned pixel are determined and input to the device. These values may be eight bit words.
A corresponding component color value of a background color is subtracted from the pixel component color value in each channel to produce adjusted color values. An adjusted color value may be divided by another color value to produce a color ratio. An adjusted color value and at least one color ratio are compared to associated upper and lower threshold values of a keyed color range. If the adjusted color and color ratios fall within the respective ranges, a signal indicative of a corresponding keyed color may be generated.
For example, in a system utilizing RGB values, R/G and B/G color ratios may be compared to respective upper and lower threshold values and the adjusted G value compared to associated upper and lower threshold values.
The keyed color generator may select between a number of keyed colors, and may operate at a dot clock rate for real time analysis of the image.
The details of one or more embodiments of the invention are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the invention will be apparent from the description and drawings, and from the claims.